package com.skivingcloud.admin.sys.service;

import com.skivingcloud.admin.sys.entity.SysMsgStream;
import com.skivingcloud.admin.sys.entity.User;
import com.skivingcloud.common.utils.PageUtils;

import java.util.Map;

import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 * 消息流水 服务类
 * </p>
 *
 * @author skivingcloud
 * @since 2022-01-29
 */
public interface ISysMsgStreamService extends IService<SysMsgStream> {

	/**
	 * 发送消息接口
	 * 
	 * @param params {"senderId":发送用户id,"pageParam":页面参数,"msgCode":消息定义编码,"businessId":业务id,"msgContext":消息内容,"msgContextParam":消息内容参数}
	 * @return
	 */
	public boolean sendMsg(Map<String, Object> params) throws Exception;

	/**
	 * 查询未读消息
	 * 
	 * @param params
	 * @return
	 */
	PageUtils queryUndealMsg(Map<String, Object> params, User user);

	/**
	 * 查询消息
	 * 
	 * @param params
	 * @return
	 */
	PageUtils queryPage(Map<String, Object> params);

	/**
	 * 主键获取
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public SysMsgStream selectById(String id) throws Exception;

	/**
	 * 主键获取
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public SysMsgStream selectMapById(String id) throws Exception;

	/**
	 * 新增消息
	 * 
	 * @param sysMsgStream
	 */
	public void saveMe(SysMsgStream sysMsgStream);

	/**
	 * 更新信息
	 * 
	 * @param sysMsgStream
	 */
	public void update(SysMsgStream sysMsgStream);

	/**
	 * 删除信息
	 * 
	 * @param ids
	 */
	public void deleteBatch(String[] ids);

	/**
	 * 获取接收人未读的消息数
	 * 
	 * @param receiverId
	 * @return
	 */
	int getUndealMsgNum(String receiverId);

	/**
	 * 标记为已读
	 * 
	 * @param ids
	 */
	void deal(String[] ids);
	
}
